草庐IT

AudioToolBox 解码AAC

全部标签

php - Swift4 JSONDecoderExpected 解码 Dictionary<String, Any> 但找到了一个数组

这个问题在这里已经有了答案:SwiftJSONDecodertypeMismatcherror(2个答案)关闭4年前。我是这方面的新手,但我一直在尝试弄清楚JSONDecoder如何用于需要从MySQL数据库检索数据的登录函数,如下面的代码所示,但我收到了这个错误。快速代码:functestParseJson(){varrequest=URLRequest(url:URL(string:"https://test.php")!)request.httpMethod="POST"letpostString=("Email=test&Password=test")print(postStr

php - Swift4 JSONDecoderExpected 解码 Dictionary<String, Any> 但找到了一个数组

这个问题在这里已经有了答案:SwiftJSONDecodertypeMismatcherror(2个答案)关闭4年前。我是这方面的新手,但我一直在尝试弄清楚JSONDecoder如何用于需要从MySQL数据库检索数据的登录函数,如下面的代码所示,但我收到了这个错误。快速代码:functestParseJson(){varrequest=URLRequest(url:URL(string:"https://test.php")!)request.httpMethod="POST"letpostString=("Email=test&Password=test")print(postStr

ios - Swift 4 可解码 : The given data was not valid JSON

我正在尝试向我的本地服务器写入一个POST请求,这是我的功能:@IBActionfuncpostButtonAction(_sender:UIButton){guardleturl=URL(string:"http://localhost:443/api/message")else{return}varrequest=URLRequest(url:url)request.httpMethod="POST"request.addValue("application/json",forHTTPHeaderField:"Content-Type")print("POSTED")letdate

ios - Swift 4 可解码 : The given data was not valid JSON

我正在尝试向我的本地服务器写入一个POST请求,这是我的功能:@IBActionfuncpostButtonAction(_sender:UIButton){guardleturl=URL(string:"http://localhost:443/api/message")else{return}varrequest=URLRequest(url:url)request.httpMethod="POST"request.addValue("application/json",forHTTPHeaderField:"Content-Type")print("POSTED")letdate

json - 如何在 Swift 4 中实现 JSON 数据的多态解码?

我正在尝试根据API端点返回的数据呈现View。我的JSON看起来(大致)像这样:{"sections":[{"title":"Featured","section_layout_type":"featured_panels","section_items":[{"item_type":"foo","id":3,"title":"Bisbee1","audio_url":"http://example.com/foo1.mp3","feature_image_url":"http://example.com/feature1.jpg"},{"item_type":"bar","id":

json - 如何在 Swift 4 中实现 JSON 数据的多态解码?

我正在尝试根据API端点返回的数据呈现View。我的JSON看起来(大致)像这样:{"sections":[{"title":"Featured","section_layout_type":"featured_panels","section_items":[{"item_type":"foo","id":3,"title":"Bisbee1","audio_url":"http://example.com/foo1.mp3","feature_image_url":"http://example.com/feature1.jpg"},{"item_type":"bar","id":

json - Swift Codable 期望解码 Dictionary<String, Any> 但发现了一个字符串/数据

我一直在使用Codable协议(protocol)这是我的JSON文件:{"Adress":[],"Object":[{"next-date":"2017-10-30T11:00:00Z","text-sample":"Sometext","image-path":["photo1.png","photo2.png"],"email":"john.doe@test.com","id":"27"},{"next-date":"2017-10-30T09:00:00Z","text-sample":"TestTest","image-path":["image1.png"],"email"

json - Swift Codable 期望解码 Dictionary<String, Any> 但发现了一个字符串/数据

我一直在使用Codable协议(protocol)这是我的JSON文件:{"Adress":[],"Object":[{"next-date":"2017-10-30T11:00:00Z","text-sample":"Sometext","image-path":["photo1.png","photo2.png"],"email":"john.doe@test.com","id":"27"},{"next-date":"2017-10-30T09:00:00Z","text-sample":"TestTest","image-path":["image1.png"],"email"

objective-c - 无法在 Swift 中使用 NSCoder 解码 Int

我正在使用带有Swift3.0的Xcode8Beta。我试图编码一个基于NSObject的简单对象,但我无法解码Int或NSInteger类型。(编码过程OK)代码classModel:NSObject,NSCoding{varseq:NSNumber?varseq2:Int?//problemwithseq2,NSIntegerisnotok,eithervarid:String?varvalue:String?overrideinit(){super.init()}requiredinit?(coderaDecoder:NSCoder){self.seq=aDecoder.deco

objective-c - 无法在 Swift 中使用 NSCoder 解码 Int

我正在使用带有Swift3.0的Xcode8Beta。我试图编码一个基于NSObject的简单对象,但我无法解码Int或NSInteger类型。(编码过程OK)代码classModel:NSObject,NSCoding{varseq:NSNumber?varseq2:Int?//problemwithseq2,NSIntegerisnotok,eithervarid:String?varvalue:String?overrideinit(){super.init()}requiredinit?(coderaDecoder:NSCoder){self.seq=aDecoder.deco